import React from 'react';
import lazyLoad from './lazy';

const Home = lazyLoad(React.lazy(() => import('@/views/home')));
const About = lazyLoad(React.lazy(() => import('@/views/about')));

// 创建路由配置
export const baseRouter = [
  {
    path: '/',
    element: <Navigate to={'/home'} />
  },
  {
    path: 'home',
    element: Home
  },
  {
    path: 'about',
    element: About
  },
  {
    path: '*',
    element: <div>404 Not Found</div>
  }
];

// 获取路由元素
export const getRoutes = () => {
  const element = useRoutes(baseRouter);

  return element;
};

export default baseRouter;
